//
// VFS.h
// Usage: FileSystem resource
// CreateDate: 2009-05-18
// Author: MaJiuyue
//
#ifndef _VFS_H_
#define _VFS_H_

#include <SCI.h>
#include "FileSystem.h"
#include "RootFS.h"
#include "UDevFS.h"

enum FS_TYPE { FS_ROOT, FS_UDEV, FS_EXT };
class VFS : public Callable
{
private:
	RootFS * m_RootFS;
	UDevFS * m_UDevFS;
	
	// external fs
	LinkedList<FileSystem *> m_ExtFS;

public:
	/*
	   Create "core.FileSystem" resource.
	   Create RootFS, UDevFS
	*/
	VFS();
	~VFS();

public:
	/* Get root of VFS */
	Directory * GetRoot();

	/* Get file with given path */
	File * GetFile(const char * path);

	/* Add filesystem and mount it at mountpoint, if NULL, do not mount */
	void AddFileSystem(FileSystem * fs, char * mountpoint);
	
	/* Get UDevFS */
	FileSystem * GetFileSystem(FS_TYPE type);
};

#endif

